/**
 * 
 */
package com.mywind.controller;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;

import com.mywind.constant.Constant;
import com.mywind.entity.core.ResponseObj;
import com.mywind.service.windfarm.IWindFarmServ;

/**
 * @author a01513
 *
 */
@Controller
@SessionAttributes(value = "mysession")
@RequestMapping(value = "kpi")
public class KPIController {
	
	@Autowired
	private IWindFarmServ service;
	
	@RequestMapping(value = "/toGenPower.do")
	public String toGenPower(){
		return "kpi/genPower";
	}
	
	@RequestMapping(value = "/toTheoryPower.do")
	public String toTheoryPower(){
		return "kpi/theoryPower";
	}
	
	@RequestMapping(value = "/toCoup.do")
	public String toCoup(){
		return "kpi/coup";
	}
	
	@RequestMapping(value = "/toLostPower.do")
	public String toLostPower(){
		return "kpi/lostPower";
	}
	
	@RequestMapping(value = "/toConsum.do")
	public String toConsum(){
		return "kpi/consum";
	}
	
	@RequestMapping(value = "/toRunTime.do")
	public String toRunTime(){
		return "kpi/runtime";
	}
	
	@RequestMapping(value = "/toUseRate.do")
	public String toUseRate(){
		return "kpi/userate";
	}
	
	@RequestMapping(value = "/toFaultNum.do")
	public String toFaultNum(){
		return "kpi/faultNum";
	}
	
	@RequestMapping(value = "/toFaultTime.do")
	public String toFaultTime(){
		return "kpi/faultTime";
	}
	
	@RequestMapping(value = "/toFaultPower.do")
	public String toFaultPower(){
		return "kpi/faultPower";
	}
	
	@RequestMapping(value = "/toCheckTime.do")
	public String toCheckTime(){
		return "kpi/checkTime";
	}
	
	@RequestMapping(value = "/toUseHour.do")
	public String toUseHour(){
		return "kpi/useHour";
	}
	
	@ResponseBody
	@RequestMapping(value = "/getGenPower.do")
	public ResponseObj getGenPower(@Param("farmid")String farmid,@Param("ltb") int ltb,@Param("htb") int htb,@Param("start") String start,@Param("end") String end){
		ResponseObj resObj = new ResponseObj();
		resObj.setResBody(service.getGenPower(farmid, ltb, htb, start, end));
		resObj.setStatus(Constant.SUC);
		return resObj;
	}
	
	@ResponseBody
	@RequestMapping(value = "/getMutiGenPower.do")
	public ResponseObj getMutiGenPower(@Param("farmList")String farmList,@Param("start") String start,@Param("end") String end){
		ResponseObj resObj = new ResponseObj();
		resObj.setResBody(service.getMutiGenPower(farmList, start, end));
		resObj.setStatus(Constant.SUC);
		return resObj;
	}
	
	@ResponseBody
	@RequestMapping(value = "/getMutiLostPower.do")
	public ResponseObj getMutiLostPower(@Param("farmList")String farmList,@Param("start") String start,@Param("end") String end){
		ResponseObj resObj = new ResponseObj();
		resObj.setResBody(service.getMutiLostPower(farmList, start, end));
		resObj.setStatus(Constant.SUC);
		return resObj;
	}
	
	@ResponseBody
	@RequestMapping(value = "/getMutiConsum.do")
	public ResponseObj getMutiConsum(@Param("farmList")String farmList,@Param("start") String start,@Param("end") String end){
		ResponseObj resObj = new ResponseObj();
		resObj.setResBody(service.getMutiConsum(farmList, start, end));
		resObj.setStatus(Constant.SUC);
		return resObj;
	}
	
	@ResponseBody
	@RequestMapping(value = "/getRunTime.do")
	public ResponseObj getRunTime(@Param("farmid")String farmid,@Param("ltb") int ltb,@Param("htb") int htb,@Param("start") String start,@Param("end") String end){
		ResponseObj resObj = new ResponseObj();
		resObj.setResBody(service.getRunTime(farmid, ltb, htb, start, end));
		resObj.setStatus(Constant.SUC);
		return resObj;
	}
	
	@ResponseBody
	@RequestMapping(value = "/getMutiRunTime.do")
	public ResponseObj getMutiRunTime(@Param("farmList")String farmList,@Param("start") String start,@Param("end") String end){
		ResponseObj resObj = new ResponseObj();
		resObj.setResBody(service.getMutiRunTime(farmList, start, end));
		resObj.setStatus(Constant.SUC);
		return resObj;
	}
	
	@ResponseBody
	@RequestMapping(value = "/getUseRate.do")
	public ResponseObj getUseRate(@Param("farmid")String farmid,@Param("ltb") int ltb,@Param("htb") int htb,@Param("start") String start,@Param("end") String end){
		ResponseObj resObj = new ResponseObj();
		resObj.setResBody(service.getUseRate(farmid, ltb, htb, start, end));
		resObj.setStatus(Constant.SUC);
		return resObj;
	}
	
	@ResponseBody
	@RequestMapping(value = "/getMutiUseRate.do")
	public ResponseObj getMutiUseRate(@Param("farmList")String farmList,@Param("start") String start,@Param("end") String end){
		ResponseObj resObj = new ResponseObj();
		resObj.setResBody(service.getMutiUseRate(farmList, start, end));
		resObj.setStatus(Constant.SUC);
		return resObj;
	}
	
	@ResponseBody
	@RequestMapping(value = "/getCheckTime.do")
	public ResponseObj getCheckTime(@Param("farmid")String farmid,@Param("ltb") int ltb,@Param("htb") int htb,@Param("start") String start,@Param("end") String end){
		ResponseObj resObj = new ResponseObj();
		resObj.setResBody(service.getCheckTime(farmid, ltb, htb, start, end));
		resObj.setStatus(Constant.SUC);
		return resObj;
	}
	
	@ResponseBody
	@RequestMapping(value = "/getMutiCheckTime.do")
	public ResponseObj getMutiCheckTime(@Param("farmList")String farmList,@Param("start") String start,@Param("end") String end){
		ResponseObj resObj = new ResponseObj();
		resObj.setResBody(service.getMutiCheckTime(farmList, start, end));
		resObj.setStatus(Constant.SUC);
		return resObj;
	}
	
	@ResponseBody
	@RequestMapping(value = "/getUseHour.do")
	public ResponseObj getUseHour(@Param("farmid")String farmid,@Param("ltb") int ltb,@Param("htb") int htb,@Param("start") String start,@Param("end") String end){
		ResponseObj resObj = new ResponseObj();
		resObj.setResBody(service.getUseHour(farmid, ltb, htb, start, end));
		resObj.setStatus(Constant.SUC);
		return resObj;
	}
	
	@ResponseBody
	@RequestMapping(value = "/getMutiUseHour.do")
	public ResponseObj getMutiUseHour(@Param("farmList")String farmList,@Param("start") String start,@Param("end") String end){
		ResponseObj resObj = new ResponseObj();
		resObj.setResBody(service.getMutiUseHour(farmList, start, end));
		resObj.setStatus(Constant.SUC);
		return resObj;
	}
	
	@RequestMapping(value = "/toDemo.do")
	public String toDemo(){
		return "underConstruction";
	}
	
	@RequestMapping(value = "/toDemo2.do")
	public String toDemo2(){
		return "kpi/demo";
	}
}
